<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/config/c.tld" prefix="c"%>
<%@ taglib prefix="fn" uri="/WEB-INF/config/fn.tld"%>
<%@ taglib prefix="fmt" uri="/WEB-INF/config/fmt.tld"%>

<!DOCTYPE HTML>
<html>
<head>
	<title>用户管理</title>
</head>
<body>
<ul class="breadcrumb">
	<li>
		<a href="index.html">首页</a>
		<i class="icon-angle-right"></i>
	</li>
	<li>
		<a href="#">用户管理</a>
		<i class="icon-angle-right"></i>
	</li>
	<li>
		<a href="#">更新信息</a>
	</li>
</ul>
<div class="row-fluid ">
	<div class="box span13">
		<div class="box-header" data-original-title>
			<h2><i class="halflings-icon white edit"></i><span class="break"></span>请填写"用户"的信息</h2>
				<div class="box-icon">
					<a href="#" class="btn-minimize"><i class="halflings-icon white chevron-up"></i></a>
				</div>
		</div>
		<div class="box-content">
			<form class="form-horizontal" action="user/manage/saveuser.html" method="post" enctype="multipart/form-data">
				<input type="hidden" name="id" value="${user.id }">
				<fieldset>
					<div class="control-group">
						<label class="control-label" >账号 </label>
						<div class="controls">
							<input type="text" class="span11" name="userName" id="userName" value="${user.userName }" required>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" >密码 </label>
						<div class="controls">
							<input type="text" class="span11" name="passWord" id="passWord" value="${user.passWord }" required>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" >真实姓名 </label>
						<div class="controls">
							<input type="text" class="span11" name="realname" id="realname" value="${user.realname }" required>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" >联系方式 </label>
						<div class="controls">
							<input type="text" class="span11" name="phoneNum" id="phoneNum" value="${user.phoneNum }" required>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" >选择角色 </label>
						<div class="controls">
							<select  class="span11" name="role" required >

							<c:forEach items="${role}" var="r">
								<option value="${r.id}">${r.name}</option>
							</c:forEach>

							</select>
						</div>
					</div>
					<div class="form-actions">
						<button type="submit" class="btn btn-primary">保存信息</button>
					</div>
				</fieldset>
			</form>
		</div>
	</div><!--/span-->
</div><!--/row-->
<script>
	$("#fileInput").change(function () {
		var objUrl = getObjectURL(this.files[1]);
		console.log("objUrl = " + objUrl);
		if (objUrl) {
			$("#imageLeft").attr("src", objUrl);
		}
	});
	//建立一个可存取到该file的url
	function getObjectURL(file) {
		var url = null;
		if (window.createObjectURL != undefined) { // basic
			url = window.createObjectURL(file);
		} else if (window.URL != undefined) { // mozilla(firefox)
			url = window.URL.createObjectURL(file);
		} else if (window.webkitURL != undefined) { // webkit or chrome
			url = window.webkitURL.createObjectURL(file);
		}

		return url;
	}
</script>
</body>
</html>
